diff --git a/owl-bot-staging/StorageControl/v2/proto/src/GPBMetadata/Google/Storage/Control/V2/StorageControl.php b/owl-bot-staging/StorageControl/v2/proto/src/GPBMetadata/Google/Storage/Control/V2/StorageControl.php new file mode 100644 index 00000000000..6292a961c28 Binary files /dev/null and b/owl-bot-staging/StorageControl/v2/proto/src/GPBMetadata/Google/Storage/Control/V2/StorageControl.php differ diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CommonLongRunningOperationMetadata.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CommonLongRunningOperationMetadata.php new file mode 100644 index 00000000000..67e1c36d73d --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CommonLongRunningOperationMetadata.php @@ -0,0 +1,273 @@ +google.storage.control.v2.CommonLongRunningOperationMetadata + */ +class CommonLongRunningOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = ''; + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $progress_percent = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time the operation was last modified. + * @type string $type + * Output only. The type of operation invoked. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation. + * @type int $progress_percent + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The time the operation was last modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of operation invoked. + * + * Generated from protobuf field string type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Output only. The estimated progress of the operation in percentage [0, + * 100]. The value -1 means the progress is unknown. + * + * Generated from protobuf field int32 progress_percent = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateFolderRequest.php new file mode 100644 index 00000000000..805011c9fe0 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateFolderRequest.php @@ -0,0 +1,281 @@ +google.storage.control.v2.CreateFolderRequest + */ +class CreateFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $folder = null; + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $folder_id = ''; + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $recursive = false; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * @param \Google\Cloud\Storage\Control\V2\Folder $folder Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * @param string $folderId Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * @return \Google\Cloud\Storage\Control\V2\CreateFolderRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Storage\Control\V2\Folder $folder, string $folderId): self + { + return (new self()) + ->setParent($parent) + ->setFolder($folder) + ->setFolderId($folderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. + * @type \Google\Cloud\Storage\Control\V2\Folder $folder + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * @type string $folder_id + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * @type bool $recursive + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket in which the folder will reside. The bucket + * must be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Storage\Control\V2\Folder|null + */ + public function getFolder() + { + return $this->folder; + } + + public function hasFolder() + { + return isset($this->folder); + } + + public function clearFolder() + { + unset($this->folder); + } + + /** + * Required. Properties of the new folder being created. + * The bucket and name of the folder are specified in the parent and folder_id + * fields, respectively. Populating those fields in `folder` will result in an + * error. + * + * Generated from protobuf field .google.storage.control.v2.Folder folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Storage\Control\V2\Folder $var + * @return $this + */ + public function setFolder($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\Folder::class); + $this->folder = $var; + + return $this; + } + + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFolderId() + { + return $this->folder_id; + } + + /** + * Required. The full name of a folder, including all its parent folders. + * Folders use single '/' characters as a delimiter. + * The folder_id must end with a slash. + * For example, the folder_id of "books/biographies/" would create a new + * "biographies/" folder under the "books/" folder. + * + * Generated from protobuf field string folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFolderId($var) + { + GPBUtil::checkString($var, True); + $this->folder_id = $var; + + return $this; + } + + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRecursive() + { + return $this->recursive; + } + + /** + * Optional. If true, parent folder doesn't have to be present and all missing + * ancestor folders will be created atomically. + * + * Generated from protobuf field bool recursive = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRecursive($var) + { + GPBUtil::checkBool($var); + $this->recursive = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateManagedFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateManagedFolderRequest.php new file mode 100644 index 00000000000..e5320e9019f --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/CreateManagedFolderRequest.php @@ -0,0 +1,221 @@ +google.storage.control.v2.CreateManagedFolderRequest + */ +class CreateManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $managed_folder = null; + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $managed_folder_id = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket this managed folder belongs to. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * @param \Google\Cloud\Storage\Control\V2\ManagedFolder $managedFolder Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * @param string $managedFolderId Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * @return \Google\Cloud\Storage\Control\V2\CreateManagedFolderRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Storage\Control\V2\ManagedFolder $managedFolder, string $managedFolderId): self + { + return (new self()) + ->setParent($parent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket this managed folder belongs to. + * @type \Google\Cloud\Storage\Control\V2\ManagedFolder $managed_folder + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * @type string $managed_folder_id + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Storage\Control\V2\ManagedFolder|null + */ + public function getManagedFolder() + { + return $this->managed_folder; + } + + public function hasManagedFolder() + { + return isset($this->managed_folder); + } + + public function clearManagedFolder() + { + unset($this->managed_folder); + } + + /** + * Required. Properties of the managed folder being created. + * The bucket and managed folder names are specified in the `parent` and + * `managed_folder_id` fields. Populating these fields in `managed_folder` + * will result in an error. + * + * Generated from protobuf field .google.storage.control.v2.ManagedFolder managed_folder = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Storage\Control\V2\ManagedFolder $var + * @return $this + */ + public function setManagedFolder($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\ManagedFolder::class); + $this->managed_folder = $var; + + return $this; + } + + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getManagedFolderId() + { + return $this->managed_folder_id; + } + + /** + * Required. The name of the managed folder. It uses a single `/` as delimiter + * and leading and trailing `/` are allowed. + * + * Generated from protobuf field string managed_folder_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setManagedFolderId($var) + { + GPBUtil::checkString($var, True); + $this->managed_folder_id = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteFolderRequest.php new file mode 100644 index 00000000000..6958ada830b --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteFolderRequest.php @@ -0,0 +1,222 @@ +google.storage.control.v2.DeleteFolderRequest + */ +class DeleteFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\DeleteFolderRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteManagedFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteManagedFolderRequest.php new file mode 100644 index 00000000000..957f9300a27 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/DeleteManagedFolderRequest.php @@ -0,0 +1,271 @@ +google.storage.control.v2.DeleteManagedFolderRequest + */ +class DeleteManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + */ + protected $allow_non_empty = false; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * Please see {@see StorageControlClient::managedFolderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\DeleteManagedFolderRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $if_metageneration_match + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * @type int|string $if_metageneration_not_match + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * @type bool $allow_non_empty + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + * @return bool + */ + public function getAllowNonEmpty() + { + return $this->allow_non_empty; + } + + /** + * Allows deletion of a managed folder even if it is not empty. + * A managed folder is empty if it manages no child managed folders or + * objects. Caller must have permission for + * storage.managedFolders.setIamPolicy. + * + * Generated from protobuf field bool allow_non_empty = 5; + * @param bool $var + * @return $this + */ + public function setAllowNonEmpty($var) + { + GPBUtil::checkBool($var); + $this->allow_non_empty = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/Folder.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/Folder.php new file mode 100644 index 00000000000..8c1eba3f85d --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/Folder.php @@ -0,0 +1,259 @@ +google.storage.control.v2.Folder + */ +class Folder extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metageneration = 0; + /** + * Output only. The creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pending_rename_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $metageneration + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time of the folder. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The modification time of the folder. + * @type \Google\Cloud\Storage\Control\V2\PendingRenameInfo $pending_rename_info + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getMetageneration() + { + return $this->metageneration; + } + + /** + * Output only. The version of the metadata for this folder. Used for + * preconditions and for detecting changes in metadata. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setMetageneration($var) + { + GPBUtil::checkInt64($var); + $this->metageneration = $var; + + return $this; + } + + /** + * Output only. The creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The modification time of the folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\PendingRenameInfo|null + */ + public function getPendingRenameInfo() + { + return $this->pending_rename_info; + } + + public function hasPendingRenameInfo() + { + return isset($this->pending_rename_info); + } + + public function clearPendingRenameInfo() + { + unset($this->pending_rename_info); + } + + /** + * Output only. Only present if the folder is part of an ongoing RenameFolder + * operation. Contains information which can be used to query the operation + * status. The presence of this field also indicates all write operations are + * blocked for this folder, including folder, managed folder, and object + * operations. + * + * Generated from protobuf field .google.storage.control.v2.PendingRenameInfo pending_rename_info = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\PendingRenameInfo $var + * @return $this + */ + public function setPendingRenameInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\PendingRenameInfo::class); + $this->pending_rename_info = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetFolderRequest.php new file mode 100644 index 00000000000..2319f89f342 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetFolderRequest.php @@ -0,0 +1,222 @@ +google.storage.control.v2.GetFolderRequest + */ +class GetFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetFolderRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the folder. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the folder's + * current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetManagedFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetManagedFolderRequest.php new file mode 100644 index 00000000000..b4deee31382 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetManagedFolderRequest.php @@ -0,0 +1,225 @@ +google.storage.control.v2.GetManagedFolderRequest + */ +class GetManagedFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + */ + protected $if_metageneration_match = null; + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * Please see {@see StorageControlClient::managedFolderName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetManagedFolderRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $if_metageneration_match + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * @type int|string $if_metageneration_not_match + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_match = 3; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * The operation succeeds conditional on the managed folder's current + * metageneration NOT matching the value here specified. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetStorageLayoutRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetStorageLayoutRequest.php new file mode 100644 index 00000000000..ca2429d9ac1 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/GetStorageLayoutRequest.php @@ -0,0 +1,162 @@ +google.storage.control.v2.GetStorageLayoutRequest + */ +class GetStorageLayoutRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + */ + protected $prefix = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * Please see {@see StorageControlClient::storageLayoutName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\GetStorageLayoutRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * @type string $prefix + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * An optional prefix used for permission check. It is useful when the caller + * only has limited permissions under a specific prefix. + * + * Generated from protobuf field string prefix = 2; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersRequest.php new file mode 100644 index 00000000000..58c36f44ffe --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersRequest.php @@ -0,0 +1,374 @@ +google.storage.control.v2.ListFoldersRequest + */ +class ListFoldersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $prefix = ''; + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $delimiter = ''; + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $lexicographic_start = ''; + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $lexicographic_end = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\ListFoldersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. + * @type int $page_size + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * @type string $page_token + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * @type string $prefix + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * @type string $delimiter + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * @type string $lexicographic_start + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * @type string $lexicographic_end + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket in which to look for folders. The bucket must + * be a hierarchical namespace enabled bucket. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of folders to return in a single response. The + * service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Optional. Filter results to folders whose names begin with this prefix. + * If set, the value must either be an empty string or end with a '/'. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDelimiter() + { + return $this->delimiter; + } + + /** + * Optional. If set, returns results in a directory-like mode. The results + * will only include folders that either exactly match the above prefix, or + * are one level below the prefix. The only supported value is '/'. + * + * Generated from protobuf field string delimiter = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDelimiter($var) + { + GPBUtil::checkString($var, True); + $this->delimiter = $var; + + return $this; + } + + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLexicographicStart() + { + return $this->lexicographic_start; + } + + /** + * Optional. Filter results to folders whose names are lexicographically equal + * to or after lexicographic_start. If lexicographic_end is also set, the + * folders listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_start = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLexicographicStart($var) + { + GPBUtil::checkString($var, True); + $this->lexicographic_start = $var; + + return $this; + } + + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLexicographicEnd() + { + return $this->lexicographic_end; + } + + /** + * Optional. Filter results to folders whose names are lexicographically + * before lexicographic_end. If lexicographic_start is also set, the folders + * listed have names between lexicographic_start (inclusive) and + * lexicographic_end (exclusive). + * + * Generated from protobuf field string lexicographic_end = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLexicographicEnd($var) + { + GPBUtil::checkString($var, True); + $this->lexicographic_end = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersResponse.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersResponse.php new file mode 100644 index 00000000000..eb67af3ca9e --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListFoldersResponse.php @@ -0,0 +1,105 @@ +google.storage.control.v2.ListFoldersResponse + */ +class ListFoldersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + */ + private $folders; + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Storage\Control\V2\Folder>|\Google\Protobuf\Internal\RepeatedField $folders + * The list of child folders + * @type string $next_page_token + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFolders() + { + return $this->folders; + } + + /** + * The list of child folders + * + * Generated from protobuf field repeated .google.storage.control.v2.Folder folders = 1; + * @param array<\Google\Cloud\Storage\Control\V2\Folder>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFolders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Storage\Control\V2\Folder::class); + $this->folders = $arr; + + return $this; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersRequest.php new file mode 100644 index 00000000000..4af92f638e5 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersRequest.php @@ -0,0 +1,233 @@ +google.storage.control.v2.ListManagedFoldersRequest + */ +class ListManagedFoldersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $prefix = ''; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $parent Required. Name of the bucket this managed folder belongs to. Please see + * {@see StorageControlClient::bucketName()} for help formatting this field. + * + * @return \Google\Cloud\Storage\Control\V2\ListManagedFoldersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the bucket this managed folder belongs to. + * @type int $page_size + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * @type string $page_token + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * @type string $prefix + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the bucket this managed folder belongs to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of managed folders to return in a single response. + * The service will use this parameter or 1,000 items, whichever is smaller. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A previously-returned page token representing part of the larger + * set of results to view. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrefix() + { + return $this->prefix; + } + + /** + * Optional. Filter results to match managed folders with name starting with + * this prefix. + * + * Generated from protobuf field string prefix = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrefix($var) + { + GPBUtil::checkString($var, True); + $this->prefix = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersResponse.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersResponse.php new file mode 100644 index 00000000000..7ca7daea2e9 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ListManagedFoldersResponse.php @@ -0,0 +1,105 @@ +google.storage.control.v2.ListManagedFoldersResponse + */ +class ListManagedFoldersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + */ + private $managed_folders; + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Storage\Control\V2\ManagedFolder>|\Google\Protobuf\Internal\RepeatedField $managed_folders + * The list of matching managed folders + * @type string $next_page_token + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManagedFolders() + { + return $this->managed_folders; + } + + /** + * The list of matching managed folders + * + * Generated from protobuf field repeated .google.storage.control.v2.ManagedFolder managed_folders = 1; + * @param array<\Google\Cloud\Storage\Control\V2\ManagedFolder>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManagedFolders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Storage\Control\V2\ManagedFolder::class); + $this->managed_folders = $arr; + + return $this; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The continuation token, used to page through large result sets. Provide + * this value in a subsequent request to return the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ManagedFolder.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ManagedFolder.php new file mode 100644 index 00000000000..46a6d1984b8 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/ManagedFolder.php @@ -0,0 +1,205 @@ +google.storage.control.v2.ManagedFolder + */ +class ManagedFolder extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $metageneration = 0; + /** + * Output only. The creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * @type int|string $metageneration + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time of the managed folder. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The modification time of the managed folder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this managed folder. + * Format: + * `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getMetageneration() + { + return $this->metageneration; + } + + /** + * Output only. The metadata version of this managed folder. It increases + * whenever the metadata is updated. Used for preconditions and for detecting + * changes in metadata. Managed folders don't have a generation number. + * + * Generated from protobuf field int64 metageneration = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setMetageneration($var) + { + GPBUtil::checkInt64($var); + $this->metageneration = $var; + + return $this; + } + + /** + * Output only. The creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The modification time of the managed folder. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/PendingRenameInfo.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/PendingRenameInfo.php new file mode 100644 index 00000000000..52172ad3749 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/PendingRenameInfo.php @@ -0,0 +1,67 @@ +google.storage.control.v2.PendingRenameInfo + */ +class PendingRenameInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $operation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $operation + * Output only. The name of the rename operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getOperation() + { + return $this->operation; + } + + /** + * Output only. The name of the rename operation. + * + * Generated from protobuf field string operation = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setOperation($var) + { + GPBUtil::checkString($var, True); + $this->operation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderMetadata.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderMetadata.php new file mode 100644 index 00000000000..d9d0313fd1a --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderMetadata.php @@ -0,0 +1,146 @@ +google.storage.control.v2.RenameFolderMetadata + */ +class RenameFolderMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + */ + protected $source_folder_id = ''; + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + */ + protected $destination_folder_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata $common_metadata + * Generic metadata for the long running operation. + * @type string $source_folder_id + * The path of the source folder. + * @type string $destination_folder_id + * The path of the destination folder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + * @return \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * Generic metadata for the long running operation. + * + * Generated from protobuf field .google.storage.control.v2.CommonLongRunningOperationMetadata common_metadata = 1; + * @param \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\CommonLongRunningOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + * @return string + */ + public function getSourceFolderId() + { + return $this->source_folder_id; + } + + /** + * The path of the source folder. + * + * Generated from protobuf field string source_folder_id = 2; + * @param string $var + * @return $this + */ + public function setSourceFolderId($var) + { + GPBUtil::checkString($var, True); + $this->source_folder_id = $var; + + return $this; + } + + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + * @return string + */ + public function getDestinationFolderId() + { + return $this->destination_folder_id; + } + + /** + * The path of the destination folder. + * + * Generated from protobuf field string destination_folder_id = 3; + * @param string $var + * @return $this + */ + public function setDestinationFolderId($var) + { + GPBUtil::checkString($var, True); + $this->destination_folder_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderRequest.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderRequest.php new file mode 100644 index 00000000000..fd0605ae995 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/RenameFolderRequest.php @@ -0,0 +1,262 @@ +google.storage.control.v2.RenameFolderRequest + */ +class RenameFolderRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $destination_folder_id = ''; + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + */ + protected $if_metageneration_match = null; + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + */ + protected $if_metageneration_not_match = null; + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + */ + protected $request_id = ''; + + /** + * @param string $name Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * Please see {@see StorageControlClient::folderName()} for help formatting this field. + * @param string $destinationFolderId Required. The destination folder ID, e.g. `foo/bar/`. + * + * @return \Google\Cloud\Storage\Control\V2\RenameFolderRequest + * + * @experimental + */ + public static function build(string $name, string $destinationFolderId): self + { + return (new self()) + ->setName($name) + ->setDestinationFolderId($destinationFolderId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * @type string $destination_folder_id + * Required. The destination folder ID, e.g. `foo/bar/`. + * @type int|string $if_metageneration_match + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * @type int|string $if_metageneration_not_match + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * @type string $request_id + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the source folder being renamed. + * Format: `projects/{project}/buckets/{bucket}/folders/{folder}` + * + * Generated from protobuf field string name = 7 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDestinationFolderId() + { + return $this->destination_folder_id; + } + + /** + * Required. The destination folder ID, e.g. `foo/bar/`. + * + * Generated from protobuf field string destination_folder_id = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDestinationFolderId($var) + { + GPBUtil::checkString($var, True); + $this->destination_folder_id = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + * @return int|string + */ + public function getIfMetagenerationMatch() + { + return isset($this->if_metageneration_match) ? $this->if_metageneration_match : 0; + } + + public function hasIfMetagenerationMatch() + { + return isset($this->if_metageneration_match); + } + + public function clearIfMetagenerationMatch() + { + unset($this->if_metageneration_match); + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration matches the given value. + * + * Generated from protobuf field optional int64 if_metageneration_match = 4; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_match = $var; + + return $this; + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + * @return int|string + */ + public function getIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match) ? $this->if_metageneration_not_match : 0; + } + + public function hasIfMetagenerationNotMatch() + { + return isset($this->if_metageneration_not_match); + } + + public function clearIfMetagenerationNotMatch() + { + unset($this->if_metageneration_not_match); + } + + /** + * Makes the operation only succeed conditional on whether the source + * folder's current metageneration does not match the given value. + * + * Generated from protobuf field optional int64 if_metageneration_not_match = 5; + * @param int|string $var + * @return $this + */ + public function setIfMetagenerationNotMatch($var) + { + GPBUtil::checkInt64($var); + $this->if_metageneration_not_match = $var; + + return $this; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A unique identifier for this request. UUID is the recommended + * format, but other formats are still accepted. This request is only + * idempotent if a `request_id` is provided. + * + * Generated from protobuf field string request_id = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout.php new file mode 100644 index 00000000000..a48fbe8ef2e --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout.php @@ -0,0 +1,239 @@ +google.storage.control.v2.StorageLayout + */ +class StorageLayout extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $location = ''; + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $location_type = ''; + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $custom_placement_config = null; + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $hierarchical_namespace = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * @type string $location + * Output only. The location of the bucket. + * @type string $location_type + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * @type \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig $custom_placement_config + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * @type \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace $hierarchical_namespace + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the StorageLayout resource. + * Format: `projects/{project}/buckets/{bucket}/storageLayout` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Output only. The location of the bucket. + * + * Generated from protobuf field string location = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLocationType() + { + return $this->location_type; + } + + /** + * Output only. The location type of the bucket (region, dual-region, + * multi-region, etc). + * + * Generated from protobuf field string location_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLocationType($var) + { + GPBUtil::checkString($var, True); + $this->location_type = $var; + + return $this; + } + + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig|null + */ + public function getCustomPlacementConfig() + { + return $this->custom_placement_config; + } + + public function hasCustomPlacementConfig() + { + return isset($this->custom_placement_config); + } + + public function clearCustomPlacementConfig() + { + unset($this->custom_placement_config); + } + + /** + * Output only. The data placement configuration for custom dual region. If + * there is no configuration, this is not a custom dual region bucket. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.CustomPlacementConfig custom_placement_config = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig $var + * @return $this + */ + public function setCustomPlacementConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\StorageLayout\CustomPlacementConfig::class); + $this->custom_placement_config = $var; + + return $this; + } + + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace|null + */ + public function getHierarchicalNamespace() + { + return $this->hierarchical_namespace; + } + + public function hasHierarchicalNamespace() + { + return isset($this->hierarchical_namespace); + } + + public function clearHierarchicalNamespace() + { + unset($this->hierarchical_namespace); + } + + /** + * Output only. The bucket's hierarchical namespace configuration. If there is + * no configuration, the hierarchical namespace is disabled. + * + * Generated from protobuf field .google.storage.control.v2.StorageLayout.HierarchicalNamespace hierarchical_namespace = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace $var + * @return $this + */ + public function setHierarchicalNamespace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Storage\Control\V2\StorageLayout\HierarchicalNamespace::class); + $this->hierarchical_namespace = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/CustomPlacementConfig.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/CustomPlacementConfig.php new file mode 100644 index 00000000000..5c05317b146 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/CustomPlacementConfig.php @@ -0,0 +1,72 @@ +google.storage.control.v2.StorageLayout.CustomPlacementConfig + */ +class CustomPlacementConfig extends \Google\Protobuf\Internal\Message +{ + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + */ + private $data_locations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $data_locations + * List of locations to use for data placement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataLocations() + { + return $this->data_locations; + } + + /** + * List of locations to use for data placement. + * + * Generated from protobuf field repeated string data_locations = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataLocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->data_locations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CustomPlacementConfig::class, \Google\Cloud\Storage\Control\V2\StorageLayout_CustomPlacementConfig::class); + diff --git a/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/HierarchicalNamespace.php b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/HierarchicalNamespace.php new file mode 100644 index 00000000000..34e91aff6d8 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/proto/src/Google/Cloud/Storage/Control/V2/StorageLayout/HierarchicalNamespace.php @@ -0,0 +1,70 @@ +google.storage.control.v2.StorageLayout.HierarchicalNamespace + */ +class HierarchicalNamespace extends \Google\Protobuf\Internal\Message +{ + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Enables the hierarchical namespace feature. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Storage\Control\V2\StorageControl::initOnce(); + parent::__construct($data); + } + + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Enables the hierarchical namespace feature. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HierarchicalNamespace::class, \Google\Cloud\Storage\Control\V2\StorageLayout_HierarchicalNamespace::class); + diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_folder.php new file mode 100644 index 00000000000..14d0a5f64d1 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_folder.php @@ -0,0 +1,83 @@ +setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + + // Call the API and handle any network failures. + try { + /** @var Folder $response */ + $response = $storageControlClient->createFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + $folderId = '[FOLDER_ID]'; + + create_folder_sample($formattedParent, $folderId); +} +// [END storage_v2_generated_StorageControl_CreateFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_managed_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_managed_folder.php new file mode 100644 index 00000000000..367c733b53f --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/create_managed_folder.php @@ -0,0 +1,77 @@ +setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + + // Call the API and handle any network failures. + try { + /** @var ManagedFolder $response */ + $response = $storageControlClient->createManagedFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + $managedFolderId = '[MANAGED_FOLDER_ID]'; + + create_managed_folder_sample($formattedParent, $managedFolderId); +} +// [END storage_v2_generated_StorageControl_CreateManagedFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_folder.php new file mode 100644 index 00000000000..ca3512485a1 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_folder.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $storageControlClient->deleteFolder($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + + delete_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_DeleteFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_managed_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_managed_folder.php new file mode 100644 index 00000000000..5fec0fb2678 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/delete_managed_folder.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $storageControlClient->deleteManagedFolder($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::managedFolderName( + '[PROJECT]', + '[BUCKET]', + '[MANAGEDFOLDER]' + ); + + delete_managed_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_DeleteManagedFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_folder.php new file mode 100644 index 00000000000..bf29421ecfd --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_folder.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Folder $response */ + $response = $storageControlClient->getFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + + get_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_managed_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_managed_folder.php new file mode 100644 index 00000000000..1d48475f4ef --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_managed_folder.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ManagedFolder $response */ + $response = $storageControlClient->getManagedFolder($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::managedFolderName( + '[PROJECT]', + '[BUCKET]', + '[MANAGEDFOLDER]' + ); + + get_managed_folder_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetManagedFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_storage_layout.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_storage_layout.php new file mode 100644 index 00000000000..3a8b9e36aeb --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/get_storage_layout.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var StorageLayout $response */ + $response = $storageControlClient->getStorageLayout($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::storageLayoutName('[PROJECT]', '[BUCKET]'); + + get_storage_layout_sample($formattedName); +} +// [END storage_v2_generated_StorageControl_GetStorageLayout_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_folders.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_folders.php new file mode 100644 index 00000000000..f8580716598 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_folders.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $storageControlClient->listFolders($request); + + /** @var Folder $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + + list_folders_sample($formattedParent); +} +// [END storage_v2_generated_StorageControl_ListFolders_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_managed_folders.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_managed_folders.php new file mode 100644 index 00000000000..7b9623d4f14 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/list_managed_folders.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $storageControlClient->listManagedFolders($request); + + /** @var ManagedFolder $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = StorageControlClient::bucketName('[PROJECT]', '[BUCKET]'); + + list_managed_folders_sample($formattedParent); +} +// [END storage_v2_generated_StorageControl_ListManagedFolders_sync] diff --git a/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/rename_folder.php b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/rename_folder.php new file mode 100644 index 00000000000..cf5a4e3e05f --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/samples/V2/StorageControlClient/rename_folder.php @@ -0,0 +1,91 @@ +setName($formattedName) + ->setDestinationFolderId($destinationFolderId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $storageControlClient->renameFolder($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Folder $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = StorageControlClient::folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = '[DESTINATION_FOLDER_ID]'; + + rename_folder_sample($formattedName, $destinationFolderId); +} +// [END storage_v2_generated_StorageControl_RenameFolder_sync] diff --git a/owl-bot-staging/StorageControl/v2/src/V2/Client/StorageControlClient.php b/owl-bot-staging/StorageControl/v2/src/V2/Client/StorageControlClient.php new file mode 100644 index 00000000000..08555ca9a1b --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/src/V2/Client/StorageControlClient.php @@ -0,0 +1,598 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/storage_control_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/storage_control_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/storage_control_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + ]; + } + + /** Implements ClientOptionsTrait::supportedTransports. */ + private static function supportedTransports() + { + return [ + 'grpc', + 'grpc-fallback', + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a bucket + * resource. + * + * @param string $project + * @param string $bucket + * + * @return string The formatted bucket resource. + */ + public static function bucketName(string $project, string $bucket): string + { + return self::getPathTemplate('bucket')->render([ + 'project' => $project, + 'bucket' => $bucket, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a folder + * resource. + * + * @param string $project + * @param string $bucket + * @param string $folder + * + * @return string The formatted folder resource. + */ + public static function folderName(string $project, string $bucket, string $folder): string + { + return self::getPathTemplate('folder')->render([ + 'project' => $project, + 'bucket' => $bucket, + 'folder' => $folder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * managed_folder resource. + * + * @param string $project + * @param string $bucket + * @param string $managedFolder + * + * @return string The formatted managed_folder resource. + */ + public static function managedFolderName(string $project, string $bucket, string $managedFolder): string + { + return self::getPathTemplate('managedFolder')->render([ + 'project' => $project, + 'bucket' => $bucket, + 'managedFolder' => $managedFolder, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * storage_layout resource. + * + * @param string $project + * @param string $bucket + * + * @return string The formatted storage_layout resource. + */ + public static function storageLayoutName(string $project, string $bucket): string + { + return self::getPathTemplate('storageLayout')->render([ + 'project' => $project, + 'bucket' => $bucket, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - bucket: projects/{project}/buckets/{bucket} + * - folder: projects/{project}/buckets/{bucket}/folders/{folder=**} + * - managedFolder: projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**} + * - storageLayout: projects/{project}/buckets/{bucket}/storageLayout + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'storage.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. At the moment, supports only + * `grpc`. *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} method for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new folder. This operation is only applicable to a hierarchical + * namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. + * + * The async variant is {@see StorageControlClient::createFolderAsync()} . + * + * @example samples/V2/StorageControlClient/create_folder.php + * + * @param CreateFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Folder + * + * @throws ApiException Thrown if the API call fails. + */ + public function createFolder(CreateFolderRequest $request, array $callOptions = []): Folder + { + return $this->startApiCall('CreateFolder', $request, $callOptions)->wait(); + } + + /** + * Creates a new managed folder. + * + * The async variant is {@see StorageControlClient::createManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/create_managed_folder.php + * + * @param CreateManagedFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ManagedFolder + * + * @throws ApiException Thrown if the API call fails. + */ + public function createManagedFolder(CreateManagedFolderRequest $request, array $callOptions = []): ManagedFolder + { + return $this->startApiCall('CreateManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes an empty folder. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. + * + * The async variant is {@see StorageControlClient::deleteFolderAsync()} . + * + * @example samples/V2/StorageControlClient/delete_folder.php + * + * @param DeleteFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteFolder(DeleteFolderRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteFolder', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes an empty managed folder. + * + * The async variant is {@see StorageControlClient::deleteManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/delete_managed_folder.php + * + * @param DeleteManagedFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteManagedFolder(DeleteManagedFolderRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Returns metadata for the specified folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. + * + * The async variant is {@see StorageControlClient::getFolderAsync()} . + * + * @example samples/V2/StorageControlClient/get_folder.php + * + * @param GetFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Folder + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFolder(GetFolderRequest $request, array $callOptions = []): Folder + { + return $this->startApiCall('GetFolder', $request, $callOptions)->wait(); + } + + /** + * Returns metadata for the specified managed folder. + * + * The async variant is {@see StorageControlClient::getManagedFolderAsync()} . + * + * @example samples/V2/StorageControlClient/get_managed_folder.php + * + * @param GetManagedFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ManagedFolder + * + * @throws ApiException Thrown if the API call fails. + */ + public function getManagedFolder(GetManagedFolderRequest $request, array $callOptions = []): ManagedFolder + { + return $this->startApiCall('GetManagedFolder', $request, $callOptions)->wait(); + } + + /** + * Returns the storage layout configuration for a given bucket. + * + * The async variant is {@see StorageControlClient::getStorageLayoutAsync()} . + * + * @example samples/V2/StorageControlClient/get_storage_layout.php + * + * @param GetStorageLayoutRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return StorageLayout + * + * @throws ApiException Thrown if the API call fails. + */ + public function getStorageLayout(GetStorageLayoutRequest $request, array $callOptions = []): StorageLayout + { + return $this->startApiCall('GetStorageLayout', $request, $callOptions)->wait(); + } + + /** + * Retrieves a list of folders. This operation is only applicable to a + * hierarchical namespace enabled bucket. + * Hierarchical namespace buckets are in allowlist preview. + * + * The async variant is {@see StorageControlClient::listFoldersAsync()} . + * + * @example samples/V2/StorageControlClient/list_folders.php + * + * @param ListFoldersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFolders(ListFoldersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFolders', $request, $callOptions); + } + + /** + * Retrieves a list of managed folders for a given bucket. + * + * The async variant is {@see StorageControlClient::listManagedFoldersAsync()} . + * + * @example samples/V2/StorageControlClient/list_managed_folders.php + * + * @param ListManagedFoldersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listManagedFolders(ListManagedFoldersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListManagedFolders', $request, $callOptions); + } + + /** + * Renames a source folder to a destination folder. This operation is only + * applicable to a hierarchical namespace enabled bucket. During a rename, the + * source and destination folders are locked until the long running operation + * completes. + * Hierarchical namespace buckets are in allowlist preview. + * + * The async variant is {@see StorageControlClient::renameFolderAsync()} . + * + * @example samples/V2/StorageControlClient/rename_folder.php + * + * @param RenameFolderRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function renameFolder(RenameFolderRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RenameFolder', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/StorageControl/v2/src/V2/gapic_metadata.json b/owl-bot-staging/StorageControl/v2/src/V2/gapic_metadata.json new file mode 100644 index 00000000000..61ee835d897 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/src/V2/gapic_metadata.json @@ -0,0 +1,68 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.storage.control.v2", + "libraryPackage": "Google\\Cloud\\Storage\\Control\\V2", + "services": { + "StorageControl": { + "clients": { + "grpc": { + "libraryClient": "StorageControlGapicClient", + "rpcs": { + "CreateFolder": { + "methods": [ + "createFolder" + ] + }, + "CreateManagedFolder": { + "methods": [ + "createManagedFolder" + ] + }, + "DeleteFolder": { + "methods": [ + "deleteFolder" + ] + }, + "DeleteManagedFolder": { + "methods": [ + "deleteManagedFolder" + ] + }, + "GetFolder": { + "methods": [ + "getFolder" + ] + }, + "GetManagedFolder": { + "methods": [ + "getManagedFolder" + ] + }, + "GetStorageLayout": { + "methods": [ + "getStorageLayout" + ] + }, + "ListFolders": { + "methods": [ + "listFolders" + ] + }, + "ListManagedFolders": { + "methods": [ + "listManagedFolders" + ] + }, + "RenameFolder": { + "methods": [ + "renameFolder" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_client_config.json b/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_client_config.json new file mode 100644 index 00000000000..b6522d27f8a --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_client_config.json @@ -0,0 +1,98 @@ +{ + "interfaces": { + "google.storage.control.v2.StorageControl": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "RESOURCE_EXHAUSTED", + "UNAVAILABLE", + "DEADLINE_EXCEEDED", + "INTERNAL", + "UNKNOWN" + ], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2.0, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetManagedFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetStorageLayout": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListFolders": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListManagedFolders": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RenameFolder": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_descriptor_config.php b/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_descriptor_config.php new file mode 100644 index 00000000000..351dee8ec73 --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/src/V2/resources/storage_control_descriptor_config.php @@ -0,0 +1,222 @@ + [ + 'google.storage.control.v2.StorageControl' => [ + 'RenameFolder' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Storage\Control\V2\Folder', + 'metadataReturnType' => '\Google\Cloud\Storage\Control\V2\RenameFolderMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'CreateFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\Folder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'CreateManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ManagedFolder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'DeleteFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'DeleteManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\Folder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetManagedFolder' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ManagedFolder', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'GetStorageLayout' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\StorageLayout', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/buckets\/[^\/]+)(?:\/.*)?$/', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'ListFolders' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFolders', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ListFoldersResponse', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListManagedFolders' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getManagedFolders', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Storage\Control\V2\ListManagedFoldersResponse', + 'headerParams' => [ + [ + 'keyName' => 'bucket', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + 'autoPopulatedFields' => [ + 'requestId' => \Google\Api\FieldInfo\Format::UUID4, + ], + ], + 'templateMap' => [ + 'bucket' => 'projects/{project}/buckets/{bucket}', + 'folder' => 'projects/{project}/buckets/{bucket}/folders/{folder=**}', + 'managedFolder' => 'projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**}', + 'storageLayout' => 'projects/{project}/buckets/{bucket}/storageLayout', + ], + ], + ], +]; diff --git a/owl-bot-staging/StorageControl/v2/tests/Unit/V2/Client/StorageControlClientTest.php b/owl-bot-staging/StorageControl/v2/tests/Unit/V2/Client/StorageControlClientTest.php new file mode 100644 index 00000000000..943de2d1ccf --- /dev/null +++ b/owl-bot-staging/StorageControl/v2/tests/Unit/V2/Client/StorageControlClientTest.php @@ -0,0 +1,872 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return StorageControlClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new StorageControlClient($options); + } + + /** @test */ + public function createFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + $response = $gapicClient->createFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFolder(); + $this->assertProtobufEquals($folder, $actualValue); + $actualValue = $actualRequestObject->getFolderId(); + $this->assertProtobufEquals($folderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + try { + $gapicClient->createFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new ManagedFolder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $managedFolder = new ManagedFolder(); + $managedFolderId = 'managedFolderId-239131156'; + $request = (new CreateManagedFolderRequest()) + ->setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + $response = $gapicClient->createManagedFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getManagedFolder(); + $this->assertProtobufEquals($managedFolder, $actualValue); + $actualValue = $actualRequestObject->getManagedFolderId(); + $this->assertProtobufEquals($managedFolderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createManagedFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $managedFolder = new ManagedFolder(); + $managedFolderId = 'managedFolderId-239131156'; + $request = (new CreateManagedFolderRequest()) + ->setParent($formattedParent) + ->setManagedFolder($managedFolder) + ->setManagedFolderId($managedFolderId); + try { + $gapicClient->createManagedFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new DeleteFolderRequest()) + ->setName($formattedName); + $gapicClient->deleteFolder($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/DeleteFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new DeleteFolderRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new DeleteManagedFolderRequest()) + ->setName($formattedName); + $gapicClient->deleteManagedFolder($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/DeleteManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteManagedFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new DeleteManagedFolderRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteManagedFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new GetFolderRequest()) + ->setName($formattedName); + $response = $gapicClient->getFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $request = (new GetFolderRequest()) + ->setName($formattedName); + try { + $gapicClient->getFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagedFolderTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new ManagedFolder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new GetManagedFolderRequest()) + ->setName($formattedName); + $response = $gapicClient->getManagedFolder($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetManagedFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagedFolderExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->managedFolderName('[PROJECT]', '[BUCKET]', '[MANAGEDFOLDER]'); + $request = (new GetManagedFolderRequest()) + ->setName($formattedName); + try { + $gapicClient->getManagedFolder($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getStorageLayoutTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $location = 'location1901043637'; + $locationType = 'locationType-1796591228'; + $expectedResponse = new StorageLayout(); + $expectedResponse->setName($name2); + $expectedResponse->setLocation($location); + $expectedResponse->setLocationType($locationType); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->storageLayoutName('[PROJECT]', '[BUCKET]'); + $request = (new GetStorageLayoutRequest()) + ->setName($formattedName); + $response = $gapicClient->getStorageLayout($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/GetStorageLayout', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getStorageLayoutExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->storageLayoutName('[PROJECT]', '[BUCKET]'); + $request = (new GetStorageLayoutRequest()) + ->setName($formattedName); + try { + $gapicClient->getStorageLayout($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFoldersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $foldersElement = new Folder(); + $folders = [ + $foldersElement, + ]; + $expectedResponse = new ListFoldersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFolders($folders); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListFoldersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listFolders($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFolders()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/ListFolders', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFoldersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListFoldersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listFolders($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagedFoldersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $managedFoldersElement = new ManagedFolder(); + $managedFolders = [ + $managedFoldersElement, + ]; + $expectedResponse = new ListManagedFoldersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setManagedFolders($managedFolders); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListManagedFoldersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listManagedFolders($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getManagedFolders()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/ListManagedFolders', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagedFoldersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $request = (new ListManagedFoldersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listManagedFolders($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function renameFolderTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/renameFolderTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name2); + $expectedResponse->setMetageneration($metageneration); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/renameFolderTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = 'destinationFolderId368368539'; + $request = (new RenameFolderRequest()) + ->setName($formattedName) + ->setDestinationFolderId($destinationFolderId); + $response = $gapicClient->renameFolder($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/RenameFolder', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getDestinationFolderId(); + $this->assertProtobufEquals($destinationFolderId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/renameFolderTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function renameFolderExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/renameFolderTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->folderName('[PROJECT]', '[BUCKET]', '[FOLDER]'); + $destinationFolderId = 'destinationFolderId368368539'; + $request = (new RenameFolderRequest()) + ->setName($formattedName) + ->setDestinationFolderId($destinationFolderId); + $response = $gapicClient->renameFolder($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/renameFolderTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createFolderAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $metageneration = 1048558813; + $expectedResponse = new Folder(); + $expectedResponse->setName($name); + $expectedResponse->setMetageneration($metageneration); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->bucketName('[PROJECT]', '[BUCKET]'); + $folder = new Folder(); + $folderId = 'folderId527488652'; + $request = (new CreateFolderRequest()) + ->setParent($formattedParent) + ->setFolder($folder) + ->setFolderId($folderId); + $response = $gapicClient->createFolderAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.storage.control.v2.StorageControl/CreateFolder', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFolder(); + $this->assertProtobufEquals($folder, $actualValue); + $actualValue = $actualRequestObject->getFolderId(); + $this->assertProtobufEquals($folderId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +}