diff --git a/buf.lock b/buf.lock index 362b4eb..f09d0a8 100644 --- a/buf.lock +++ b/buf.lock @@ -9,8 +9,8 @@ deps: - remote: buf.build owner: cerbos repository: cerbos-api - commit: f68054407be34c5f9de72b58253186b2 - digest: shake256:34807b5aa37ddd25985d781c0ff91f4e6c130eb265d84f785f2e23185660a8192cb7107fad21c1bc51ed92b04ab59ce1ef036ea459d058de01a1907f4ce6aec3 + commit: 75004b0044b24782a2000dbf4f395cd1 + digest: shake256:e11642fbe5550cae550115f8a857a89726d373f79766d82bcaea41c88d3436c12fb953d7af5a4eed18e5feffd3ea80ae072ca42f70aceea019eb046be09d833d - remote: buf.build owner: googleapis repository: googleapis diff --git a/protos/cerbos/policy/v1/policy.proto b/protos/cerbos/policy/v1/policy.proto index 46a999b..cd97f2f 100644 --- a/protos/cerbos/policy/v1/policy.proto +++ b/protos/cerbos/policy/v1/policy.proto @@ -230,7 +230,13 @@ message Match { } message Output { - string expr = 1; + message When { + string rule_activated = 1; + string condition_not_met = 2; + } + + string expr = 1 [deprecated = true]; + When when = 2; } message Schemas { diff --git a/src/Cerbos/Policy/V1/Output.php b/src/Cerbos/Policy/V1/Output.php index c600e26..deea039 100644 --- a/src/Cerbos/Policy/V1/Output.php +++ b/src/Cerbos/Policy/V1/Output.php @@ -14,9 +14,14 @@ class Output extends \Google\Protobuf\Internal\Message { /** - * Generated from protobuf field string expr = 1 [json_name = "expr"]; + * Generated from protobuf field string expr = 1 [json_name = "expr", deprecated = true]; + * @deprecated */ protected $expr = ''; + /** + * Generated from protobuf field .cerbos.policy.v1.Output.When when = 2 [json_name = "when"]; + */ + protected $when = null; /** * Constructor. @@ -25,6 +30,7 @@ class Output extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $expr + * @type \Cerbos\Policy\V1\Output\When $when * } */ public function __construct($data = NULL) { @@ -33,26 +39,62 @@ public function __construct($data = NULL) { } /** - * Generated from protobuf field string expr = 1 [json_name = "expr"]; + * Generated from protobuf field string expr = 1 [json_name = "expr", deprecated = true]; * @return string + * @deprecated */ public function getExpr() { + @trigger_error('expr is deprecated.', E_USER_DEPRECATED); return $this->expr; } /** - * Generated from protobuf field string expr = 1 [json_name = "expr"]; + * Generated from protobuf field string expr = 1 [json_name = "expr", deprecated = true]; * @param string $var * @return $this + * @deprecated */ public function setExpr($var) { + @trigger_error('expr is deprecated.', E_USER_DEPRECATED); GPBUtil::checkString($var, True); $this->expr = $var; return $this; } + /** + * Generated from protobuf field .cerbos.policy.v1.Output.When when = 2 [json_name = "when"]; + * @return \Cerbos\Policy\V1\Output\When|null + */ + public function getWhen() + { + return $this->when; + } + + public function hasWhen() + { + return isset($this->when); + } + + public function clearWhen() + { + unset($this->when); + } + + /** + * Generated from protobuf field .cerbos.policy.v1.Output.When when = 2 [json_name = "when"]; + * @param \Cerbos\Policy\V1\Output\When $var + * @return $this + */ + public function setWhen($var) + { + GPBUtil::checkMessage($var, \Cerbos\Policy\V1\Output\When::class); + $this->when = $var; + + return $this; + } + } diff --git a/src/Cerbos/Policy/V1/Output/When.php b/src/Cerbos/Policy/V1/Output/When.php new file mode 100644 index 0000000..46fe493 --- /dev/null +++ b/src/Cerbos/Policy/V1/Output/When.php @@ -0,0 +1,88 @@ +cerbos.policy.v1.Output.When + */ +class When extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field string rule_activated = 1 [json_name = "ruleActivated"]; + */ + protected $rule_activated = ''; + /** + * Generated from protobuf field string condition_not_met = 2 [json_name = "conditionNotMet"]; + */ + protected $condition_not_met = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $rule_activated + * @type string $condition_not_met + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Cerbos\Policy\V1\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field string rule_activated = 1 [json_name = "ruleActivated"]; + * @return string + */ + public function getRuleActivated() + { + return $this->rule_activated; + } + + /** + * Generated from protobuf field string rule_activated = 1 [json_name = "ruleActivated"]; + * @param string $var + * @return $this + */ + public function setRuleActivated($var) + { + GPBUtil::checkString($var, True); + $this->rule_activated = $var; + + return $this; + } + + /** + * Generated from protobuf field string condition_not_met = 2 [json_name = "conditionNotMet"]; + * @return string + */ + public function getConditionNotMet() + { + return $this->condition_not_met; + } + + /** + * Generated from protobuf field string condition_not_met = 2 [json_name = "conditionNotMet"]; + * @param string $var + * @return $this + */ + public function setConditionNotMet($var) + { + GPBUtil::checkString($var, True); + $this->condition_not_met = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(When::class, \Cerbos\Policy\V1\Output_When::class); + diff --git a/src/GPBMetadata/Cerbos/Policy/V1/Policy.php b/src/GPBMetadata/Cerbos/Policy/V1/Policy.php index 4dc7867..522648b 100644 Binary files a/src/GPBMetadata/Cerbos/Policy/V1/Policy.php and b/src/GPBMetadata/Cerbos/Policy/V1/Policy.php differ