diff --git a/metadata/Api/Control.php b/metadata/Api/Control.php index a43d689..ead6700 100644 --- a/metadata/Api/Control.php +++ b/metadata/Api/Control.php @@ -14,13 +14,15 @@ public static function initOnce() { if (static::$is_initialized == true) { return; } + \GPBMetadata\Google\Api\Policy::initOnce(); $pool->internalAddGeneratedFile( ' -¾ +ń google/api/control.proto -google.api" +google.api"Q Control - environment ( Bn + environment ( 1 +method_policies ( 2.google.api.MethodPolicyBn com.google.apiB ControlProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig¢GAPIbproto3' , true); diff --git a/metadata/Api/Policy.php b/metadata/Api/Policy.php new file mode 100644 index 0000000..9d3ce0f --- /dev/null +++ b/metadata/Api/Policy.php @@ -0,0 +1,35 @@ +internalAddGeneratedFile( + ' +ė +google/api/policy.proto +google.api google/protobuf/descriptor.proto"S + FieldPolicy +selector (  +resource_permission (  + resource_type ( "S + MethodPolicy +selector ( 1 +request_policies ( 2.google.api.FieldPolicyBp +com.google.apiB PolicyProtoPZEgoogle.golang.org/genproto/googleapis/api/serviceconfig;serviceconfigų¢GAPIbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/src/Api/Control.php b/src/Api/Control.php index d7ee23e..5b9bdf1 100644 --- a/src/Api/Control.php +++ b/src/Api/Control.php @@ -26,6 +26,12 @@ class Control extends \Google\Protobuf\Internal\Message * Generated from protobuf field string environment = 1; */ protected $environment = ''; + /** + * Defines policies applying to the API methods of the service. + * + * Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4; + */ + private $method_policies; /** * Constructor. @@ -37,6 +43,8 @@ class Control extends \Google\Protobuf\Internal\Message * The service controller environment to use. If empty, no control plane * feature (like quota and billing) will be enabled. The recommended value for * most services is servicecontrol.googleapis.com + * @type array<\Google\Api\MethodPolicy>|\Google\Protobuf\Internal\RepeatedField $method_policies + * Defines policies applying to the API methods of the service. * } */ public function __construct($data = NULL) { @@ -74,5 +82,31 @@ public function setEnvironment($var) return $this; } + /** + * Defines policies applying to the API methods of the service. + * + * Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMethodPolicies() + { + return $this->method_policies; + } + + /** + * Defines policies applying to the API methods of the service. + * + * Generated from protobuf field repeated .google.api.MethodPolicy method_policies = 4; + * @param array<\Google\Api\MethodPolicy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMethodPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MethodPolicy::class); + $this->method_policies = $arr; + + return $this; + } + } diff --git a/src/Api/FieldPolicy.php b/src/Api/FieldPolicy.php new file mode 100644 index 0000000..53474a4 --- /dev/null +++ b/src/Api/FieldPolicy.php @@ -0,0 +1,181 @@ +google.api.FieldPolicy + */ +class FieldPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Selects one or more request or response message fields to apply this + * `FieldPolicy`. + * When a `FieldPolicy` is used in proto annotation, the selector must + * be left as empty. The service config generator will automatically fill + * the correct value. + * When a `FieldPolicy` is used in service config, the selector must be a + * comma-separated string with valid request or response field paths, + * such as "foo.bar" or "foo.bar,foo.baz". + * + * Generated from protobuf field string selector = 1; + */ + protected $selector = ''; + /** + * Specifies the required permission(s) for the resource referred to by the + * field. It requires the field contains a valid resource reference, and + * the request must pass the permission checks to proceed. For example, + * "resourcemanager.projects.get". + * + * Generated from protobuf field string resource_permission = 2; + */ + protected $resource_permission = ''; + /** + * Specifies the resource type for the resource referred to by the field. + * + * Generated from protobuf field string resource_type = 3; + */ + protected $resource_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects one or more request or response message fields to apply this + * `FieldPolicy`. + * When a `FieldPolicy` is used in proto annotation, the selector must + * be left as empty. The service config generator will automatically fill + * the correct value. + * When a `FieldPolicy` is used in service config, the selector must be a + * comma-separated string with valid request or response field paths, + * such as "foo.bar" or "foo.bar,foo.baz". + * @type string $resource_permission + * Specifies the required permission(s) for the resource referred to by the + * field. It requires the field contains a valid resource reference, and + * the request must pass the permission checks to proceed. For example, + * "resourcemanager.projects.get". + * @type string $resource_type + * Specifies the resource type for the resource referred to by the field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Selects one or more request or response message fields to apply this + * `FieldPolicy`. + * When a `FieldPolicy` is used in proto annotation, the selector must + * be left as empty. The service config generator will automatically fill + * the correct value. + * When a `FieldPolicy` is used in service config, the selector must be a + * comma-separated string with valid request or response field paths, + * such as "foo.bar" or "foo.bar,foo.baz". + * + * Generated from protobuf field string selector = 1; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects one or more request or response message fields to apply this + * `FieldPolicy`. + * When a `FieldPolicy` is used in proto annotation, the selector must + * be left as empty. The service config generator will automatically fill + * the correct value. + * When a `FieldPolicy` is used in service config, the selector must be a + * comma-separated string with valid request or response field paths, + * such as "foo.bar" or "foo.bar,foo.baz". + * + * Generated from protobuf field string selector = 1; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Specifies the required permission(s) for the resource referred to by the + * field. It requires the field contains a valid resource reference, and + * the request must pass the permission checks to proceed. For example, + * "resourcemanager.projects.get". + * + * Generated from protobuf field string resource_permission = 2; + * @return string + */ + public function getResourcePermission() + { + return $this->resource_permission; + } + + /** + * Specifies the required permission(s) for the resource referred to by the + * field. It requires the field contains a valid resource reference, and + * the request must pass the permission checks to proceed. For example, + * "resourcemanager.projects.get". + * + * Generated from protobuf field string resource_permission = 2; + * @param string $var + * @return $this + */ + public function setResourcePermission($var) + { + GPBUtil::checkString($var, True); + $this->resource_permission = $var; + + return $this; + } + + /** + * Specifies the resource type for the resource referred to by the field. + * + * Generated from protobuf field string resource_type = 3; + * @return string + */ + public function getResourceType() + { + return $this->resource_type; + } + + /** + * Specifies the resource type for the resource referred to by the field. + * + * Generated from protobuf field string resource_type = 3; + * @param string $var + * @return $this + */ + public function setResourceType($var) + { + GPBUtil::checkString($var, True); + $this->resource_type = $var; + + return $this; + } + +} + diff --git a/src/Api/MethodPolicy.php b/src/Api/MethodPolicy.php new file mode 100644 index 0000000..faeb40a --- /dev/null +++ b/src/Api/MethodPolicy.php @@ -0,0 +1,121 @@ +google.api.MethodPolicy + */ +class MethodPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Selects a method to which these policies should be enforced, for example, + * "google.pubsub.v1.Subscriber.CreateSubscription". + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + * NOTE: This field must not be set in the proto annotation. It will be + * automatically filled by the service config compiler . + * + * Generated from protobuf field string selector = 9; + */ + protected $selector = ''; + /** + * Policies that are applicable to the request message. + * + * Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2; + */ + private $request_policies; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selector + * Selects a method to which these policies should be enforced, for example, + * "google.pubsub.v1.Subscriber.CreateSubscription". + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + * NOTE: This field must not be set in the proto annotation. It will be + * automatically filled by the service config compiler . + * @type array<\Google\Api\FieldPolicy>|\Google\Protobuf\Internal\RepeatedField $request_policies + * Policies that are applicable to the request message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Api\Policy::initOnce(); + parent::__construct($data); + } + + /** + * Selects a method to which these policies should be enforced, for example, + * "google.pubsub.v1.Subscriber.CreateSubscription". + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + * NOTE: This field must not be set in the proto annotation. It will be + * automatically filled by the service config compiler . + * + * Generated from protobuf field string selector = 9; + * @return string + */ + public function getSelector() + { + return $this->selector; + } + + /** + * Selects a method to which these policies should be enforced, for example, + * "google.pubsub.v1.Subscriber.CreateSubscription". + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + * NOTE: This field must not be set in the proto annotation. It will be + * automatically filled by the service config compiler . + * + * Generated from protobuf field string selector = 9; + * @param string $var + * @return $this + */ + public function setSelector($var) + { + GPBUtil::checkString($var, True); + $this->selector = $var; + + return $this; + } + + /** + * Policies that are applicable to the request message. + * + * Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequestPolicies() + { + return $this->request_policies; + } + + /** + * Policies that are applicable to the request message. + * + * Generated from protobuf field repeated .google.api.FieldPolicy request_policies = 2; + * @param array<\Google\Api\FieldPolicy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequestPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\FieldPolicy::class); + $this->request_policies = $arr; + + return $this; + } + +} +